package com.afdor.rws.event.driven.api;

import com.afdor.rws.event.driven.entities.Event;

import java.util.Arrays;
import java.util.List;

/**
 * 事件持久化处理器
 *
 * @author 悭梵
 * @date Created in 2018-08-20 17:31
 */
@FunctionalInterface
public interface EventPersistenceHandler {

    /**
     * 持久化事件
     *
     * @param events
     */
    default void persistence(Event... events) {
        if (events == null || events.length == 0) {
            return;
        }
        persistence(Arrays.asList(events));
    }

    /**
     * 持久化事件
     *
     * @param eventList
     */
    void persistence(List<Event> eventList);
}
